﻿@model IEnumerable<tutors_clus.Models.course>

@{
    ViewBag.Title = "Danh sách lớp học";
    Layout = "~/Views/Shared/_Layout_Private.cshtml";
}
<div id="cleft">@Html.Partial("_menu_admin")</div>
<div id="cright">
<h3>Danh sách các lớp học</h3>
<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.name_cou)
        </th>
        <th>Tên giáo viên dạy</th>
        <th>Học viên thuộc lớp</th>
        @*<th>
            @Html.DisplayNameFor(model => model.limited_num)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.registered_num)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.createdate_cou)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.startdate_cou)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.enddate_cou)
        </th>*@
        <th>
            @Html.DisplayNameFor(model => model.status_cou)
        </th>
        <th>

        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.name_cou)
        </td>
        <td>
            @Html.DisplayFor(model=>item.teacher.fullname_tea)
        </td>
        <td>
            @if (item.student_course.Count() > 0)
            {
               <ul>
                    @foreach (var item2 in item.student_course)
                    {
                        <li>@item2.student.fullname_stu</li>
                    }
               </ul> 
            }
            else
            {
                 <div>Chưa có sinh viên đăng ký</div>
            }
            
        </td>
        @*<td>
            @Html.DisplayFor(modelItem => item.limited_num)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.registered_num)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.createdate_cou).ToString().Substring(0,10)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.startdate_cou).ToString().Substring(0,10)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.enddate_cou).ToString().Substring(0,10)
        </td>*@
        <td id="@item.id_cou">
          
            @if (item.status_cou == true)
            {
                @Ajax.ActionLink("tick", "Change_sta_cou", new {id = item.id_cou}, new AjaxOptions {InsertionMode=InsertionMode.Replace, UpdateTargetId = item.id_cou.ToString()},new { @class="true" })
            }
            else
            {
                 @Ajax.ActionLink("tick", "Change_sta_cou", new {id = item.id_cou}, new AjaxOptions {InsertionMode=InsertionMode.Replace, UpdateTargetId = item.id_cou.ToString()},new { @class="false" })
            }
            
        </td>
        @*<td>
            @Html.ActionLink("Xem chi tiết", "Detai_Course", new { id=@item.id_cou})
        </td>*@
    </tr>
}

</table>
</div>